<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        width: 100vw;
        height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
      }
      .tip {
        color: #555;
      }
      .error {
        visibility: hidden;
        color: red;
      }
      body.error .tip {
        visibility: hidden;
      }
      body.error .error {
        visibility: visible;
      }
    </style>
  </head>
  <body>
    <h1 class="tip">Widget GitHub OAuth Callback Page</h1>
    <h1 class="error">Code not found</h1>
    <script>
      const code = new URLSearchParams(location.search).get("code");
      if (code) {
        location.href = `${location.origin}/?code=${code}#/cb/github/widget`;
      } else {
        document.body.classList.add("error");
      }
    </script>
  </body>
</html>
